use "$attendeefile" if inlist(YearAttended,2017,2018), clear

gen female = Gender=="Female"
gen white = Race=="White"
label var experience "Experience"
label var Age "Age"
gen Democrat = AppointingPres=="Democratic" if !mi(AppointingPres)
label var Democrat "Democratic Appointee"
gen ArtIII = inlist(type,"Circuit","District")
recode ArtIII (0=2)

table (ArtIII type), stat(freq) stat(median Age experience) stat(mean female white Democrat) nformat(%3.2f mean) nformat(%2.0f median)
collect export analysis_output/table1_demographics.docx, replace